<?php
/**
 * 模拟wifi路由器发送虚拟身份数据
 * 需要重新配置host地址
 *
 */

require 'config.php';

$host = HOST_ADDR;

function request_by_curl($remote_server, $post_string) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $remote_server);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERAGENT, "AnyWiFi.com's CURL Example beta");
    $data = curl_exec($ch);
    curl_close($ch);

    return $data;
}

$data =  '"devmac":"48-5d-60-a3-bc-8a","climac":"c0-f2-fb-8c-c0-48","ssid":"","bssid":"","time":"1458968069","signal":"0"'.chr(13).chr(10).'"devmac":"48-5d-60-a3-bc-8a","climac":"ec-5a-86-c6-eb-5c","ssid":"","bssid":"","time":"1458968069","signal":"0","qq":"11111111111","qq":"333333333","taobao":"444444444"'.chr(10).'"devmac":"48-5d-60-a3-bc-8a","climac":"20-68-9d-c7-51-33","ssid":"","bssid":"","time":"1458968070","signal":"-65","qq":"22222221111","taobao":"dddddddd"';
echo request_by_curl('cliprobe_curl/index.php?action=reportclient', $data);


$ap_data =  '"devmac":"48-5d-60-a3-bc-8a","bssid":"c0-f2-fb-8c-c0-48","ssid":"2182","channel":"1","encrypt":"WPA2","signal":"-83"'.chr(13).chr(10).'"devmac":"48-5d-60-a3-bc-88","bssid":"c0-f2-fb-8c-c0-48","ssid":"2182","channel":"1","encrypt":"WPA2","signal":"-83"';
echo request_by_curl('cliprobe_curl/index.php?action=reportap', $ap_data);